package src.Packets;

import src.Util.Stream;
import src.Players.*;
import src.Main;

public class ObjectClick3
{

    /*
    * make sure to document EVERY coordinate to go with each object.
    * This will prevent people from spawning an object client side and actually using it.
    * So make sure to include with the id, objectX == # && objectY == #
    */

    public ObjectClick3(Player p)
    {
        if(p == null || p.inStream == null)
        {
            return;
        }
        if(!p.objectClick3)
        {
            p.clickX = p.inStream.readSignedWordBigEndian();
            p.clickY = p.inStream.readUnsignedWord();
            p.clickId = p.inStream.readUnsignedWordBigEndianA();
            p.objectClick3 = true;
        }
        if(Main.m.ge.getDistance(p.clickX, p.clickY, p.absX, p.absY) > 1)
        {
            return;
        }
        p.objectClick3 = false;
        switch(p.clickId)
        {
            default:
                Main.m.log("[" + p.playerIndex + "-" + p.username + "] Object3 click " + p.clickId + ", x = " + p.clickX + ", y = " +p.clickY);
            break;
        }
    }
}